package entity

import (
	"github.com/jinzhu/gorm"
	"time"
)

type Student struct {
	*gorm.Model
	StuName       string    `json:"name"`
	FamilyAddress string    `json:"family_address"`
	BirthDay      time.Time `json:"birth_day"`
}

func (s Student) TableName() string {
	return "student"
}

func (s Student) GetAllStudents(db *gorm.DB) []*Student {
	var students []*Student
	db.Find(&students)
	return students
}

func (s Student) InsertStudent(db *gorm.DB, stu Student) {
	_ = db.Create(&stu).Error
}
